﻿using System;
using System.Windows.Forms;

namespace Smart.Windows.Navigation
{
    /// <summary>
    /// Controlビューベースクラス
    /// </summary>
    public partial class ControlViewBase : UserControl, INavigatorAware, IViewEventSupport, IViewNotifySupport
    {
        private Navigator navigator;

        /// <summary>
        /// 
        /// </summary>
        protected Navigator Navigator
        {
            get { return this.navigator; }
            set { this.navigator = value; }
        }

        /// <summary>
        /// コンストラクタ
        /// </summary>
        public ControlViewBase()
        {
            InitializeComponent();
        }

        /// <summary>
        /// ナビゲーター設定
        /// </summary>
        /// <param name="navigator">ナビゲーター</param>
        public void SetNavigator(Navigator navigator)
        {
            this.navigator = navigator;
        }

        /// <summary>
        /// ビューオープン
        /// </summary>
        /// <param name="args">引数</param>
        public virtual void OnViewOpen(ViewForwardEventArgs args)
        {
            // please override
        }

        /// <summary>
        /// ビュー活性化
        /// </summary>
        /// <param name="args">引数</param>
        public virtual void OnViewActived(ViewForwardEventArgs args)
        {
            // please override
        }

        /// <summary>
        /// ビュークローズ
        /// </summary>
        public virtual void OnViewClose()
        {
            // please override
        }

        /// <summary>
        /// ビュー通知
        /// </summary>
        /// <param name="sender">送信元</param>
        /// <param name="args">引数</param>
        public virtual void OnViewNotify(Navigator sender, ViewNotifyEventArgs args)
        {
            // please override
        }
    }
}
